<?php
include('log4php/Logger.php');
include_once('../lib/Mailer.php');

Logger::configure('config.ini');
$logger = Logger::getLogger('intf');

$mail = new Mailer();

$email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
if(eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$email)) 
{
    $rst = $mail->send($email);
    $res['errno'] = $rst;
}
else
{
    $res['errno'] = -2;
}

$output = json_encode($res);
$logger->trace("input: email=$email; res: $output");
echo $output;
